 <?php
 function db_mycheck_exit($arays,$value)
 {
 	$len = count($arays);
 	for($i=0;$i<$len;$i++)
 	{
 		if($arays[$i] == $value)
 		return TRUE;	
 	} 
 	return FALSE;
 }
 global $wpdb;
 $args = array('title_li'  => '','orderby' => 'name','order' =>'ASC','taxonomy' => 'category','exclude' => array(1),'hide_empty' => 0,'hierarchical'  => true,'depth'  => 1);
 $category = get_categories($args); 
 //print_r($category);
 ### price
 $key = $wpdb->prefix.'price';
 $querys = "SELECT meta_key,meta_value FROM $wpdb->postmeta WHERE meta_key='".$key."' ORDER BY meta_value ASC";
 $results = $wpdb->get_results($querys,OBJECT);
 $myresult = array();
 foreach ($results as $value) 
 {
 	if(!db_mycheck_exit($myresult, $value->meta_value))
 	{
 		$myresult[] = $value->meta_value;
 	}
 }
 //print_r($myresult);
 $search_hotel_star = $_GET['search-hotel-star'];		// metakey
 $search_hotel_price  = $_GET['search-hotel-price'];		// metakey
 $search_hotel_country = $_GET['search-hotel-country'];	// category
 ?>
 <style>
.content-box-1
{
	margin-top:-5px;
}
.side-danh-muc-top
{
	margin-top:13px;
}
.content-box-1
{
			margin-top:15px;	
}
.content-box-1 img
{
	padding:0;
}
.content-box-1 p
{
	width:665px !important;
	line-height:20px;
	word-spacing:1px;
}
.tabs-2
{
	margin-top:-40px;
}
.hotel_select_error
{
	border-color:red;
}
</style>
 <div class="box-search-tour">
                	<span class="title">Search Hotels</span>
                  <form action="<?php bloginfo('url');?>" method="get">
           	 
                    <p class="row">
                    		<input type="hidden" name="s" id="s" value="search-hotels"/>
                        	<label class="label-1">Choose Star Hotel : </label>
                            <select name="search-hotel-star" id="search-hotel-star">
                            	<option value="">-- ALL --</option>
                                <option <?php if($search_hotel_star==1) echo 'selected="selected"';?> value="1"> 1 star</option>
                                <option <?php if($search_hotel_star==2) echo 'selected="selected"';?> value="2"> 2 star</option>
                                <option <?php if($search_hotel_star==3) echo 'selected="selected"';?> value="3"> 3 star</option>   
                                <option <?php if($search_hotel_star==4) echo 'selected="selected"';?> value="4"> 4 star</option>
                                <option <?php if($search_hotel_star==5) echo 'selected="selected"';?> value="5"> 5 star</option>                             
                            </select>
                            <label class="label-2">Price :</label>
                            <select name="search-hotel-price" id="search-hotel-price">
                            	<option value="">-- ALL --</option>
                               <?php
                               foreach ($myresult as $values) 
                               {
                               		if($search_hotel_price == $values)
                               		{
                               			?>
		                               	<option selected="selected" value="<?php echo $values;?>"><?php echo $values;?> USD</option>
		                               	<?php	
                               		}
                               		else 
                               		{
                               			?>
			                               	<option value="<?php echo $values;?>"><?php echo $values;?> USD</option>
			                            <?php
                               		}                               
                               }
                               ?>                              
                            </select>
                      </p>
                      <p class="row">
                        	<label class="label-1">Country :  </label>                        	
                            <select name="search-hotel-country" id="search-hotel-country">
                            	<option value="">-- ALL --</option>
                                <?php
                                foreach ($category as $value) 
                                {
                                	if($search_hotel_country == $value->slug)
                                	{
                                	?>
	                               	 	<option selected="selected" value="<?php echo $value->slug;?>"><?php echo str_ireplace("Hotel in", "", $value->name);?></option>
	                                <?php	
                                	}
                                	else 
                                	{
                                	?>
	                               	 	<option value="<?php echo $value->slug;?>"><?php echo str_ireplace("Hotel in", "", $value->name);?></option>
	                                <?php	
                                	}                                 
                                } 
                                ?>                                
                            </select>
                             <label class="label-2"></label>
                             <!-- 
                            <select name="hotel-location">
                            	<option value="1">-- ALL --</option>
                                <option value="1">-- ALL --</option>
                                <option value="1">-- ALL --</option>
                                <option value="1">-- ALL --</option>                                
                            </select>
                            -->
                            <input type="submit" value="" id="go_search_hotel"/>
                      </p>
                    </form>
                </div>
   <script type="text/javascript" src="<?php bloginfo('template_url');?>/js/mysearchhotel.js"></script>